package com.lyfei.yd.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lyfei.yd.mapper.UserMapper;
import com.lyfei.yd.domain.dto.UserQueryDto;
import com.lyfei.yd.domain.entity.User;
import org.springframework.stereotype.Service;

@Service("userService")
public class UserService extends BaseService<UserMapper, User> {

    public User getByOpenId(String openId) {
        return this.getOne(new QueryWrapper<User>().eq("weixin_openid", openId));
    }

    public IPage<User> getUserListPage(UserQueryDto userQueryDto) {
        return this.baseMapper.getUserListPage(new Page<>(userQueryDto.getCurrent(), userQueryDto.getPageSize()), userQueryDto);
    }
}
